#include <cstdio>
#include <climits>
#include <algorithm>

using namespace std;

int main(int argc, char const *argv[]) {
    int data[1000];
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%d", &data[i]);
    sort(data, data + n);

    int result = INT_MAX;
    for (int i = 0; i < n - 1; i++) {
        if(data[i+1] - data[i] < result)
            result = data[i+1] - data[i];
    }
    printf("%d", result);
    return 0;
}